package com.odm.communitymanage.ui.pay

import android.widget.LinearLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.odm.communitymanage.R
import com.odm.communitymanage.core.bean.TodayPrice

/**
 * @description: 今日价格列表 适配器
 * @author: ODM
 * @date: 2020/4/21
 */
class TodayPriceAdapter(data : MutableList<TodayPrice>):
    BaseQuickAdapter<TodayPrice , BaseViewHolder>(R.layout.item_today_common_price , data){


    override fun convert(holder: BaseViewHolder, item: TodayPrice) {
        holder.setText(R.id.tvPrice_TodayPrice , item.price)
        holder.setText(R.id.tvName_TodayPrice ,item.name)

        holder.getView<LinearLayout>(R.id.ll_TodayPrice).background = when(item.type){
            0 -> context.getDrawable(R.color.common_price_blue)
            1 -> context.getDrawable(R.color.common_price_green)
            2 -> context.getDrawable(R.color.common_price_orange)
            else -> context.getDrawable(R.color.common_price_red)
        }
    }
}